package cn.itcast.Thread_03;
//使用匿名内部类的方式实现Runnable接口，重新复写Runnable接口中的run方法。
public class test {
    public static void main(String[] args) {
        //使用匿名对象实现多线程，run表示任务类的对象
        Runnable run = new Runnable(){
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName()+"==="+i);
                }
            }
        };
        //创建线程对象
        Thread t1 = new Thread(run, "五杀");
        Thread t2 = new Thread(run, "三杀");
        Thread t3 = new Thread(run, "绝杀");
        t1.start();
        t2.start();
        t3.start();

    }
}
